/****************************************************************************

 main-widget.hpp -

Copyright (C) Michael R Fisher <mfisher31@gmail.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 01222-1307 USA

****************************************************************************/

#ifndef MAINWIDGET_HPP_
#define MAINWIDGET_HPP_

#include <map>

#include <gdkmm.h>
#include <gtkmm.h>

#include "control-box.hpp"
#include "plugin.hpp"

class MainWidget : public Gtk::VBox
{
public:
  typedef enum { IntType, BoolType, FloatType } control_t;

  MainWidget(const char* ui_bundle);
  ~MainWidget();

  void add_control(Port& port);
  void set_symbol_map(Plugin::map_t* map);
  void set_plugin_info(PluginInfo* info);

  sigc::signal<void, uint32_t, float> signal_write_control;

protected:

  Gtk::Widget* create_control(Port& port);

  // signal handlers
  void on_control_changed(string& symbol, float value);

  std::string m_ui_bundle; // path to bundle of this gui
  std::string m_p_bundle;  // path to the plugin this gui controls

  std::map<std::string, Gtk::Adjustment*> m_adj_map;

  Gtk::Frame m_frame;
  Gtk::Table m_table;
  Gtk::HBox header,footer;
  Glib::RefPtr<Gdk::Pixbuf> m_icon;
  Plugin::map_t *p_symbol_map;
  PluginInfo    *p_info;
  ControlBox    c_box;
};

#endif /* MAINWIDGET_HPP_ */
